#include <stdio.h>
#include <sys/termios.h>

using namespace std;

#ifndef STDIN_FILENO
#define STDIN_FILENO 0
#endif

#ifndef TCSANOW
#define TCSANOW 0
#endif

struct termios t;

const string AESKEY = "abcdefghijklmnopqrstuvwxyz123456"; // 32byte
const string SEEDKEY = "abcdefghijklmnop"; // 16bite
const string TRIPLEDESKEY = "abcdefghijklmnopqrstuvwx"; // 24bite

void fnOffBufferedInput()
{
	tcgetattr(STDIN_FILENO, &t); //get the current terminal I/O structure
	t.c_lflag &= ~ICANON; //Manipulate the flag bits to do what you want it to do
	tcsetattr(STDIN_FILENO, TCSANOW, &t); //Apply the new settings
}

void fnOnBufferedInput()
{
	tcgetattr(STDIN_FILENO, &t); //get the current terminal I/O structure
	t.c_lflag |= ICANON; //Manipulate the flag bits to do what you want it to do
	tcsetattr(STDIN_FILENO, TCSANOW, &t); //Apply the new settings
}

int getch(void)
{
	fnOffBufferedInput();
	int ch = getchar(); /* standard getchar call */
	fnOnBufferedInput();
	return ch; /*return received char */
}
